<!DOCTYPE html>
<html>
<head>
    <title>${tableConfig.viewTitle}列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <#if tempEngine == 'freemaker'>
    ${r'<#include "/include/commonCss.html"/>'}
    <#else>
    #parse("/include/commonCss.html")
    </#if>
</head>

<body class="gray-bg" id="${ firstLowerClassPre }Body">
	<div class="wrapper wrapper-content animated fadeInUp listPage">
	    <div class="row">
	        <div class="col-sm-12">
	            <div class="ibox">
	                <div class="ibox float-e-margins">
	                    <div class="ibox-title">
	                        <h5>${tableConfig.viewTitle}列表</h5>
	                        <div class="ibox-tools">
	                            <a class="collapse-link">
	                            	<i class="fa fa-chevron-up"></i>
	                            </a>
	                        </div>
	                    </div>
	                    <div class="ibox-content">
                            <form id="${ firstLowerClassPre }SearchForm" class="search-from" novalidate="novalidate">
                                <div class="row">
                                <#list tableConfig.searchFields as searchField>
                                    <div class="col-sm-3">
                                        <div class="query-field col-sm-3">
                                            ${fieldMap[searchField.fieldName].viewName}
                                        </div>
                                        <div class="query-value col-sm-9">
                                        <#if fieldMap[searchField.fieldName].proType == 'Date' >
                                                <input type="text" id="${searchField.searchName}" name="${searchField.searchName}" class="form-control layer-date" placeholder="${fieldMap[searchField.fieldName].dateFormat}" data-format="${fieldMap[searchField.fieldName].dateFormat}"/>
                                        <#elseif fieldMap[searchField.fieldName].proType == 'Integer' && fieldMap[searchField.fieldName].columnLength lt 5>
                                            <select class="form-control" id="${searchField.searchName}" name="${searchField.searchName}">
                                                <option value="">请选择</option>
                                                <#list fieldMap[searchField.fieldName].enumList as enum>
                                                <option value="${enum.value}">${enum.name}</option>
                                                </#list>
                                            </select>
                                        <#else>
                                            <#if fieldMap[searchField.fieldName].proType == 'Integer' || fieldMap[searchField.fieldName].proType == 'Long' >
                                            <input type="text" id="${searchField.searchName}" name="${searchField.searchName}" class="form-control integer"/>
                                            <#elseif fieldMap[searchField.fieldName].proType == 'BigDecimal'>
                                            <input type="text" id="${searchField.searchName}" name="${searchField.searchName}" class="form-control float"/>
                                            <#else>
                                            <input type="text" id="${searchField.searchName}" name="${searchField.searchName}" class="form-control"/>
                                            </#if>
                                        </#if>
                                        </div>
                                    </div>
                                <#if searchField_index != 0 && (searchField_index+1)%3 == 0 && searchField_has_next>
                                </div>
                                <div class="row">
                                </#if>
                                </#list>
                                </div>
                            </form>

	                        <div class="example">
	                            <div class="table-toolbar btn-group hidden-xs" id="tableEventsToolbar" role="group">
                                    <#if !tableConfig.newPageEdit>
                                    <button type="button" onClick="addInitForm()" title="新增" class="btn btn-outline btn-default">
                                        新增
                                    </button>
                                    <button type="button" onClick="editInitForm()" title="修改" class="btn btn-outline btn-default">
                                        修改
                                    </button>
                                    <#else>
                                    <button type="button" onClick="addInitForm()" title="新增" class="btn btn-outline btn-default">
                                        新增
                                    </button>
                                    <button type="button" onClick="editInitForm()" title="修改" class="btn btn-outline btn-default">
                                        修改
                                    </button>
                                    </#if>
	                                <button type="button" onClick="delete${ classPre }()" title="删除" class="btn btn-outline btn-default">
                                        删除
	                                </button>
                                    <#if tableConfig.needExport>
                                    <button type="button" onClick="jsExport('${ firstLowerClassPre }Body','${ firstLowerClassPre }SearchForm')" title="导出" class="btn btn-outline btn-default">
                                        导出
                                    </button>
                                    </#if>
	                            </div>
	                            <table id="pagetable" data-mobile-responsive="true">
	                                <thead>
	                                <tr>
	                                    <th data-radio="true"></th>
	                                    <th data-formatter="boostrapTableSortFormatter" data-align="center">序号</th>
                                        <#--ID默认隐藏显示-->
                                        <#list properties as pro>
                                            <#if pro.proName == 'id'>
                                        <th data-field="${pro.proName}" data-align="center" data-visible="false">${pro.columnDesc}</th>
                                            </#if>
                                        </#list>
                                        <#list tableConfig.viewFields as viewField>
                                            <#if fieldMap[viewField].proType == 'Date'>
                                        <th data-field="${viewField}" data-align="center" data-formatter="boostrapDateFormatter${fieldMap[viewField].tableDateFormat}">${fieldMap[viewField].viewName}</th>
                                            <#else>
                                        <th data-field="<#if fieldMap[viewField].hasEnum>${viewField}Str<#else>${viewField}</#if>" data-align="center">${fieldMap[viewField].viewName}</th>
                                            </#if>
                                        </#list>
                                        <#list properties as pro>
                                            <#if pro.proName == 'createTime' || pro.proName == 'updateTime'>
                                        <th data-field="${pro.proName}" data-align="center" data-visible="false" data-formatter="boostrapDateFormatter">${pro.columnDesc}</th>
                                            </#if>
                                        </#list>
	                                </tr>
	                                </thead>
	                            </table>
	                        </div>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	</div>
    <#if tempEngine == 'freemaker'>
    ${r'<#include "/include/commonJs.html"/>'}
        <#if !tableConfig.newPageEdit>
    ${r'<#include "'}/${moduleName}/form/${ classPre?uncap_first }Form.html"/>
        <#else>
    ${r'<#include "'}/${moduleName}/form/${ classPre?uncap_first }PageForm.html"/>
        </#if>
    <#else>
    #parse("/include/commonJs.html")
        <#if !tableConfig.newPageEdit>
    #parse("/${moduleName}/form/${ classPre?uncap_first }Form.html")
        <#else>
    #parse("/${moduleName}/form/${ classPre?uncap_first }PageForm.html")
        </#if>
    </#if>

    <!--页面通用后台请求url-->
    <input type="hidden" id="pageListUrl" value="/${moduleName}/${ firstLowerClassPre }/pageList.do">
    <input type="hidden" id="byIdUrl" value="/${moduleName}/${ firstLowerClassPre }/getById.do">
    <input type="hidden" id="deleteUrl" value="/${moduleName}/${ firstLowerClassPre }/delete.do">
    <input type="hidden" id="exportUrl" value="/${moduleName}/${ firstLowerClassPre }/exportList.do">
    <!--页面通用后台请求url-->
</body>

<script>
    // 列表页面的ID  -- 保证系统全局唯一
    var ${ firstLowerClassPre }BodyId = "${ firstLowerClassPre }Body";
    // 编辑弹出层的ID -- 保证同一个页面唯一
    var ${ firstLowerClassPre }FormPagelId = "${ firstLowerClassPre }FormPage";

    $(document).ready(function () {
        // 初始化页面
        intPage(${ firstLowerClassPre }BodyId);
        // 初始化分页table
        intPageTable(${ firstLowerClassPre }BodyId, "pagetable", "${ firstLowerClassPre }SearchForm");
    });

    // form新增时初始化
    function addInitForm() {
        /*****1.新增前初始化表单*****/
        beforeInitAddModalForm(${ firstLowerClassPre }BodyId, "form-edit", "新增${tableConfig.viewTitle}");

        /*****2.自有业务处理*****/

        /*****3.业务处理完继续初始化*****/
        afterInitAddModalForm(${ firstLowerClassPre }BodyId, "form-edit");
    };

    // form修改时初始化
    function editInitForm() {
        /*****1.修改前初始化表单*****/
        var data = beforeInitEditModalForm(${ firstLowerClassPre }FormPagelId ,"pagetable", "form-edit", "修改${tableConfig.viewTitle}");

        if (isEmpty(data)) {
            return;
        }

        /*****2.自有业务处理*****/

        /*****3.业务处理完继续初始化*****/
        afterInitEditModalForm(${ firstLowerClassPre }FormPagelId, "form-edit");
    };

    // 删除
    function delete${ classPre }() {
        // 调用删除方法
        var deleteResult = deleteTableRow(${ firstLowerClassPre }BodyId, null, function (deleteResult, id) {

        });
    };
</script>
</html>
